package com.example.springboot01.service;

import com.example.springboot01.config.FileParserRegistry;
import com.example.springboot01.service.impl.CsvFileParser;
import com.example.springboot01.service.impl.ExcelFileParser;
import com.example.springboot01.service.impl.JsonFileParser;
import org.springframework.stereotype.Service;

@Service
public class ParseFileService {



    public void parseFile(String fType){
//        if (fType.equals("csv")) {
//            new CsvFileParser().parse();
//        } else if (fType.equals("excel")) {
//            new ExcelFileParser().parse();
//        } else {
//            new JsonFileParser().parse();
//        }
        final FileParser parser = FileParserRegistry.getBean(fType, FileParser.class);
        parser.parse();
    }
}
